object NextPrimes {
  def main(args: Array[String]): Unit = {
    var count = 0
    var num = 10001

    while (count < 10) {
      if (isPrime(num)) {
        println(num)
        count += 1
      }
      num += 1
    }
  }

  def isPrime(n: Int): Boolean = {
    if (n <= 1) false
    else (2 to math.sqrt(n).toInt).forall(n % _ != 0)
  }
}